﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel;
using System.ServiceProcess;
using System.Text;

namespace vroom.wcf.tcponly.service
{
	public class TcpOnlyService : ServiceBase
	{
		#region Members
		
		public ServiceHost _serviceHost = null;

		#endregion

		public TcpOnlyService()
		{
			ServiceName = "PROTOBUF WCF Service";
		}

		public static void Main()
		{
			ServiceBase.Run(new TcpOnlyService());
		}

		protected override void OnStart(string[] args)
		{
			if (_serviceHost != null)
			{
				_serviceHost.Close();
			}

			_serviceHost = new ServiceHost(typeof(TcpService));
			_serviceHost.Open();


		}

		protected override void OnStop()
		{
			if (_serviceHost != null)
			{
				_serviceHost.Close();
				_serviceHost = null;

			}
		}
	}
}
